package com.imc.api.order.repository;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/*
 * 类描述：API课程mapper
 * 开发者：tanweiping
 * 创建日期：2018/10/28 21:22
 */
@Mapper
public interface IApiLessonMapper {

    /*
     * YT  2018/10/28 21:23
     * 方法描述：获取推荐课程
     */
    @Select("(SELECT * from t_lesson lesson WHERE lesson.hot = 1 AND lesson.lessonType = '2' ORDER BY lesson.createTime DESC LIMIT #{sizeVideo}) \n" +
            "UNION ALL\n" +
            "(SELECT * from t_lesson lesson WHERE lesson.hot = 1 AND lesson.lessonType = '1' ORDER BY lesson.createTime DESC LIMIT #{sizeCast}) ")
    List <Map <String, Object>> getRecommend(@Param("sizeVideo") Integer sizeVideo, @Param("sizeCast") Integer sizeCast);
}
